#lang rosetta-racket


(provide enumerate-n
         enumerate-m-n
         lofted-surface
         prism)


(define (enumerate-n fn a b n)
  (map fn (: < a .. < (+ n 1) > .. b >)))

(define (enumerate-m-n fn u1 u2 m v1 v2 n)
  (enumerate-n
   (λ (u) (enumerate-n (λ (v) (fn u v)) v1 v2 n))
   u1
   u2
   m))

(define (lofted-surface cs-lst)
  (loft (map spline cs-lst)))

(define (prism cs w)
  (loft
   (surface (line-closed cs))
   (surface (line-closed (map (λ (p) (+x p w)) cs)))))